package com.i2bt.util.tree;

import java.io.Serializable;

/**
 * 
 * Title : 目录结点类
 *
 * Description : 存放对应目录
 *
 * CreatedTime : 2014-10-10
 *
 * @author wuliao & kakaxi & yi & flame
 *
 * @version 1.0
 *
 */
public class Node<T> implements Serializable{
	
	/**
	 * 序列化
	 */
	private static final long serialVersionUID = 4338409587707670359L;
	
	private T data;  // 目录信息类
	
	private Node<T> leftNode;  // 左结点
	
	private Node<T> rightNode;  // 右结点
	
	private Node<T> parentNode; // 父结点
	
	/**
	 * 目录中的资源数量
	 */
	private int length;
	
	public Node() {
		this(null);
	}
	
	public Node(T data) {
		this.data = data;
	}
	
	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

	public Node<T> getLeftNode() {
		return leftNode;
	}

	public void setLeftNode(Node<T> leftNode) {
		this.leftNode = leftNode;
	}

	public Node<T> getRightNode() {
		return rightNode;
	}

	public void setRightNode(Node<T> rightNode) {
		this.rightNode = rightNode;
	}
	
	@Override
	public String toString() {
		return super.toString();
	}

	public Node<T> getParentNode() {
		return parentNode;
	}

	public void setParentNode(Node<T> parentNode) {
		this.parentNode = parentNode;
	}
	
	public int getLength() {
		return length;
	}
	
	public void addLength() {
		length++;
	}
	
	public void reduceLength() {
		length--;
	}
	
}
